//
// CTileElement.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.IStream;

public class CTileElement {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CTileElement(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CTileElement obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CTileElement(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void copyFlagsFromOther(CTileElement other) {
    nel3dJNI.CTileElement_copyFlagsFromOther(swigCPtr, this, CTileElement.getCPtr(other), other);
  }

  public void setTile(SWIGTYPE_p_unsigned_int value) {
    nel3dJNI.CTileElement_Tile_set(swigCPtr, this, SWIGTYPE_p_unsigned_int.getCPtr(value));
  }

  public SWIGTYPE_p_unsigned_int getTile() {
    long cPtr = nel3dJNI.CTileElement_Tile_get(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_int(cPtr, false);
  }

  public void setTileOrient(int i, short orient) {
    nel3dJNI.CTileElement_setTileOrient(swigCPtr, this, i, orient);
  }

  public short getTileOrient(int i) {
    return nel3dJNI.CTileElement_getTileOrient(swigCPtr, this, i);
  }

  public void setTile256Info(boolean is256x256, short uvOff) {
    nel3dJNI.CTileElement_setTile256Info__SWIG_0(swigCPtr, this, is256x256, uvOff);
  }

  public void setTile256Info(boolean is256x256) {
    nel3dJNI.CTileElement_setTile256Info__SWIG_1(swigCPtr, this, is256x256);
  }

  public void getTile256Info(SWIGTYPE_p_bool is256x256, SWIGTYPE_p_unsigned_char uvOff) {
    nel3dJNI.CTileElement_getTile256Info(swigCPtr, this, SWIGTYPE_p_bool.getCPtr(is256x256), SWIGTYPE_p_unsigned_char.getCPtr(uvOff));
  }

  public void setTileSubNoise(short subNoise) {
    nel3dJNI.CTileElement_setTileSubNoise(swigCPtr, this, subNoise);
  }

  public short getTileSubNoise() {
    return nel3dJNI.CTileElement_getTileSubNoise(swigCPtr, this);
  }

  public void serial(IStream f) {
    nel3dJNI.CTileElement_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public void setVegetableState(CTileElement.TVegetableInfo state) {
    nel3dJNI.CTileElement_setVegetableState(swigCPtr, this, state.swigValue());
  }

  public CTileElement.TVegetableInfo getVegetableState() {
    return CTileElement.TVegetableInfo.swigToEnum(nel3dJNI.CTileElement_getVegetableState(swigCPtr, this));
  }

  public CTileElement() {
    this(nel3dJNI.new_CTileElement(), true);
  }

  public final static class TVegetableInfo {
    public final static TVegetableInfo AboveWater = new TVegetableInfo("AboveWater", nel3dJNI.CTileElement_AboveWater_get());
    public final static TVegetableInfo UnderWater = new TVegetableInfo("UnderWater");
    public final static TVegetableInfo IntersectWater = new TVegetableInfo("IntersectWater");
    public final static TVegetableInfo VegetableDisabled = new TVegetableInfo("VegetableDisabled");
    public final static TVegetableInfo VegetInfoLast = new TVegetableInfo("VegetInfoLast");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TVegetableInfo swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TVegetableInfo.class + " with value " + swigValue);
    }

    private TVegetableInfo(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TVegetableInfo(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TVegetableInfo(String swigName, TVegetableInfo swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TVegetableInfo[] swigValues = { AboveWater, UnderWater, IntersectWater, VegetableDisabled, VegetInfoLast };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
